<?php
	include("../include/init.php");//将配置文件全部加载进来
	include("../include/check_login.php");//登录
	
	$set = new sql_class("settings");

	$set_list = $set->select()->getAll();

	if($_POST){
		$affect_id = array();
		foreach($_POST as $key=>$item){//循环插入数据(纵向数据，要一条一条更新)item就是set_value，$key就是set_name

			$data = array(
				"set_value"=>$item,
				);

			$where ="set_name = '$key'";//组装一个更新条件

			$affect_id[] = $set->update($data,$where);
			
		}
		
		if(in_array(1,$affect_id)){//判断数组中有无1,因为更新成功会返回1,失败就会返回0
			show_msg("更新网站设置成功","sys_info.php");
			exit;
		}else{
			show_msg("更新网站设置失败","sys_info.php");
			exit;
		}
	


	}

	

	$smarty->assign("set_list",$set_list);
	$smarty->display("admin/sys_info.html");//连接index.html



?>